<%@ page import="java.util.Map" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2021/3/20
  Time: 8:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%

    request.setCharacterEncoding("utf-8");
    Map<String, String[]> parameterMap = request.getParameterMap();
    Set<Map.Entry<String, String[]>> entries = parameterMap.entrySet();
    for (Map.Entry<String, String[]> entry : entries) {
        out.print("<h3>");
        out.print(entry.getKey()+","+ Arrays.toString(entry.getValue()));
        out.print("</h3>");

    }
    String ip=request.getRemoteAddr();
    String rname=request.getParameter("realname");
    String pass=request.getParameter("mypass");
    String birthday=request.getParameter("birthday");
    String [] like=request.getParameterValues("like");
%>
<h1><%=ip%></h1>
<h1>姓名：<%=rname%></h1>
<h1>birthday <%=birthday%></h1>
<h1>爱好:
    <%
        for(int i=0;like!=null&&i<like.length;i++)
            out.print(like[i]+",");
    %>
<%
    if(rname!=null&& pass!=null&& rname.length()>=2&&pass.length()>=6){
        //welcome 转发过去
        //request.getRequestDispatcher("/welcome.jsp").forward(request,response);
        response.sendRedirect("welcome.jsp");
    }else{
        //out.print("信息不完整");
        request.setAttribute("msg","信息不完整");
        request.getRequestDispatcher("/regForm.jsp").forward(request,response);
    }
%>
</h1>
</body>
</html>
